package com.jy.api.payReq;

import com.jy.api.domain.Order;
import com.jy.api.domain.StorePay;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class SaoBeiJSPayReq {
    private String pay_ver="100";
    private String pay_type="010";
    private String service_id="012";
    private String merchant_no;
    private String terminal_id;
    private String terminal_trace;
    private String terminal_time;
    private String total_fee;
    private String sub_appid;
    private String open_id;
    private String notify_url;
    private String key_sign;


    public SaoBeiJSPayReq(Order order, StorePay storePay, String openId, String sub_appid) {
        this.merchant_no = storePay.getMchId();
        this.terminal_id = storePay.getTerminalId();
        this.terminal_trace = order.getId();
        this.total_fee = String.valueOf((int) Math.rint(order.getAmount() * 100));
        this.sub_appid = sub_appid;
        this.open_id = openId;
    }

}
